-
Notifications
You must be signed in to change notification settings - Fork 0
Add variable pattern tests for egg #33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Co-authored-by: hzhangxyz <11623447+hzhangxyz@users.noreply.github.com>
Co-authored-by: hzhangxyz <11623447+hzhangxyz@users.noreply.github.com>
Co-authored-by: hzhangxyz <11623447+hzhangxyz@users.noreply.github.com>
- Congruence test now correctly tests: a(`x)=b(`x) → f(a(t))=f(b(t)) - Substitution test now correctly tests: f(a(`x)), a(`x)=b(`x) → f(b(t)) Both tests now use nested function applications as intended Co-authored-by: hzhangxyz <11623447+hzhangxyz@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds comprehensive variable pattern support tests to the egg testing suite, addressing issue #28. The tests demonstrate that variable patterns (using backtick notation like `x) can match any concrete term through unification, and verify that the system correctly derives concrete instances from variable patterns.
Key Changes:
- Added five new test functions that mirror existing tests but use variable patterns instead of concrete terms
- Tests verify symmetry, transitivity, congruence, substitution, and complex combinations work with variables
- All tests follow the existing testing patterns and use the same test fixture infrastructure
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| task = asyncio.create_task(main(addr, engine, session)) | ||
| await asyncio.sleep(0.3) | ||
| task.cancel() | ||
| try: | ||
| await task | ||
| except asyncio.CancelledError: | ||
| pass |
Copilot
AI
Dec 23, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test setup and teardown logic is duplicated across all five new test functions. Consider extracting the common pattern of creating a task, waiting 0.3 seconds, cancelling it, and handling CancelledError into a helper function or fixture to reduce duplication and improve maintainability. This pattern appears in lines 218-224, 246-252, 280-286, 318-324, and 374-380.
| task.cancel() | ||
| try: | ||
| await task | ||
| except asyncio.CancelledError: |
Copilot
AI
Dec 23, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'except' clause does nothing but pass and there is no explanatory comment.
| task.cancel() | ||
| try: | ||
| await task | ||
| except asyncio.CancelledError: |
Copilot
AI
Dec 23, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'except' clause does nothing but pass and there is no explanatory comment.
| try: | ||
| await task | ||
| except asyncio.CancelledError: | ||
| pass |
Copilot
AI
Dec 23, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'except' clause does nothing but pass and there is no explanatory comment.
| pass | |
| # The task is expected to be cancelled as part of this test. | |
| assert task.cancelled() |
| task.cancel() | ||
| try: | ||
| await task | ||
| except asyncio.CancelledError: |
Copilot
AI
Dec 23, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'except' clause does nothing but pass and there is no explanatory comment.
| except asyncio.CancelledError: | |
| except asyncio.CancelledError: | |
| # Expected when stopping the background task during test teardown. |
| task.cancel() | ||
| try: | ||
| await task | ||
| except asyncio.CancelledError: |
Copilot
AI
Dec 23, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'except' clause does nothing but pass and there is no explanatory comment.
| except asyncio.CancelledError: | |
| except asyncio.CancelledError: | |
| # Task cancellation is expected here: we stop the background `main` loop for this test. |
Summary: Add Variable Support Tests to Egg ✅
Successfully implemented variable-based versions of all existing egg tests as requested in issue "egg的测试缺少对变量的支持".
Changes Made:
a(\x) == b(`x),b(`x) == c(`x)→a(t) == c(t)`)a(\x)=b(`x)→f(a(t))=f(b(t))`f(a(\x)),a(`x)=b(`x)→f(b(t))`Technical Details:
(unary a \x)` for function applicationOriginal prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.